package com.wanxi.test;

import com.wanxi.uitl.Path;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class ClearTxt {
    public static void main(String[] args) {
        String path = Path.PATH.getPath();//父路径，指文件夹
        String fileName = Path.FILE_NAME.getPath();//子
        File file = new File(path, fileName);
        OutputStream outputStream = null;

        try {
            outputStream = new FileOutputStream(file);
            String str = "中华人民共和国";
            outputStream.write(str.getBytes(StandardCharsets.UTF_8), 3, 6);
            outputStream.write(null);
            outputStream.write("null".getBytes(StandardCharsets.UTF_8));

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                outputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public void aa() {
        try (OutputStream outputStream = new FileOutputStream("");) {
            outputStream.write("".getBytes(StandardCharsets.UTF_8));
//            outputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
